import {
  configureStore,
  ThunkAction,
  Action,
  createAction,
} from "@reduxjs/toolkit";
import counterReducer from "../features/counter/counterSlice";
import userReducer from "../features/userSlice";
import todoReducer from "../features/todo/todoSlice";

export const store = configureStore({
  reducer: {
    counter: counterReducer,
    user: userReducer,
    todo: todoReducer,
  },
});

// const addTodo = createAction("ADDTODO");
// console.log("addTodo", addTodo());

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
export type AppThunk<ReturnType = void> = ThunkAction<
  ReturnType,
  RootState,
  unknown,
  Action<string>
>;
